<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>物料管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#importBox_goods").hide();
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		
		
		function shows(n){
			$("#idss").val(n);
			$("#importBox_goods").show();
		}
		$(function(){
			$("#auditingStatus").val(1);
			$("input[name='status']").click(function(){
				$("#auditingStatus").val($(this).val());
				if($(this).val()==1){
					//$("#auditingRemark").val("");
					//$("#auditingRemark").attr("style","display:none;")
					$("#auditingRemark").val("");
					$("#spa").text("");
					$("#auditingRemark").css('visibility','hidden')
				}else{
					//$("#auditingRemark").removeAttr("style")
					$("#spa").text("");
					$("#auditingRemark").val("");
					$("#auditingRemark").css('visibility','visible')
				}
			
				
			})
			
		})
		
		function confirm_imbox(){	
			var auditingRemark=$.trim($("#auditingRemark").val());
			var status=$("#auditingStatus").val();
			/* if(auditingRemark.length<1&& status==2){
				$("#spa").text("不能为空")
				return false
			}
			if(auditingRemark.length>100 && auditingRemark!=""&& auditingRemark!=null&& status==2){
				$("#spa").text((auditingRemark.length)+"/100,字数超限")
				return false
			}
			
			
			else{
				$("#forms").submit();
				$("#importBox_goods").hide();
			} */
		   
			if(status==2){
				 if(auditingRemark.length<1){
					 $("#spa").text("不能为空")
						return false
				 }
				 
				 if(auditingRemark.length>100){
						$("#spa").text((auditingRemark.length)+"/100,字数超限")
						return false
					}
				 if(auditingRemark.length>=1 &&auditingRemark.length<=100){
					 $("#forms").submit();
					$("#importBox_goods").hide();
				 }
			}else{
				$("#forms").submit();
				$("#importBox_goods").hide();
			}
			
		}
		
		function close_imbox(){
			$("#importBox_goods").hide();
		}
		
		
		$(function(){
			$("#auditingRemark").keydown(function(){
				
				$("#spa").text("")
			})
			
			
		})
	</script>
	
	<style>
		#importBox_goods{
			position:fixed;
			padding:0 15px;
			width:300px;
			height:300px;
			background:#FFF;
			top:10%;
			left:25%;
			margin:0 auto;
			border:1px solid #CCC;
			box-shadow:3px 3px 10px 4px #DDD;
			z-index: 9999;
			
		}
		#importBox_goods .ib_title{
			margin-bottom:35px;
		}
       
	</style>
</head>
<body>
   <div id="importBox_goods" class="hide">
			<div class='ib_title'>
			 <h3>请选择审核结果</h3>
			</div>
			 <form action="${ctx }/sys/materiel/updateAuditing" method="post" id="forms">
					 <input type="radio" id="passStatus" name="status" checked='checked' value="1"/> 通过 <input type="radio" id="unPassStatus" name="status" value="2"/> 不通过：
					
                     <textarea rows="3" cols="20" name="auditingRemark" id="auditingRemark" style="visibility:hidden;width:285px;height:85px;margin-top:10px;" onchange="shenHe()">
                                                                                                              
                     </textarea><span id="spa" style="color:red"></span>
                     
                     <input id="auditingStatus" name="auditingStatus" type="hidden" />
                      <input id="idss" name="useId" type="hidden" />
			        </form>
					
					<input id="btnCancel" class="btn" type="button" style='' value="确定" onclick="confirm_imbox()"/>
					<input id="btnCancel" class="btn" type="button" style='margin-left:10px;' value="取消" onclick="close_imbox()"/>
	</div>
	
	<ul class="nav nav-tabs">
		<li class="active"><a href="javascript:void(0)">物料审核列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="materiel" action="${ctx}/sys/materiel/auditingMaterList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>配件编号：</label>
				<form:input path="partsCode" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li><label>物料编号：</label>
				<form:input path="code" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			
			<li><label>厂家编号：</label>
				<form:input path="venderCode" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<div style="display:none;">
	<sys:message content="${message}"/>
	</div>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>物料编号</th>
				<th>物料名称</th>
				<th>配件编号</th>
				<th>所属类目</th>
				<th>原ERP内码</th>
				<th>制造商品牌</th>
				<th>厂家编号</th>
				<th>物料来源</th>
				<shiro:hasPermission name="sys:materiel:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="materiel" varStatus="status">
			<tr>
				<td>
					${status.index+1}
				</td>
				<td>
					<a href="${ctx }/sys/materiel/viewMateriel?useId=${materiel.id}">${materiel.code}</a>
				</td>
				<td>
					${materiel.cnName}
				</td>
				<td>
					${materiel.partsCode}
				</td>
				<td>
					${materiel.name1},${materiel.name2},${materiel.name3}
				</td>
				
				<td>
					${materiel.erp}
				</td>
				
				<td>
					${materiel.vName}
				</td>
				<td>
					${materiel.venderCode}
				</td>
				
				<td>
					${materiel.userName}
				</td>
				<shiro:hasPermission name="sys:materiel:edit"><td>
				    
    				<a href="javascript:void(0)" onclick="shows(${materiel.id})">审核</a>
					
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>